--takes a few minutes to run

isSpecial :: Integer -> Bool
isSpecial x
         | (getSumOfString $ show x) == x = True
         | otherwise = False

getSumOfString :: String -> Integer
getSumOfString [] = 0
getSumOfString (x:xs) = ((read [x])::Integer) ^ 5 + getSumOfString xs

specials = [x | x <- [2..999999], isSpecial x]

main = sum specials